package com.zhipu.resetbalance.mobile.dao;

import com.raizlabs.android.dbflow.sql.language.SQLite;
import com.zhipu.resetbalance.mobile.event.NumberedEntity;
import com.zhipu.resetbalance.mobile.event.NumberedEntity_Table;

import java.util.List;

public class NumberedEntityDao {

    private NumberedEntityDao() {
    }

    private static final class SingletonHolder {
        private static final NumberedEntityDao INSTANCE = new NumberedEntityDao();
    }

    public static NumberedEntityDao getInstance() {
        return SingletonHolder.INSTANCE;
    }



    /**
     * 获取所有数据
     *
     * @return
     */
    public List<NumberedEntity> getAllList() {
        return SQLite.select().from(NumberedEntity.class).where().orderBy(NumberedEntity_Table.NumberedEntityId,true).queryList();
    }


    /**
     * 获取编号
     * @return
     */
    public NumberedEntity acquireNumber(){
        NumberedEntity mNumberedEntity = SQLite.select().from(NumberedEntity.class).where(NumberedEntity_Table.select.eq(true)).querySingle();
        return mNumberedEntity;
    }

}
